home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 March / CHIP Mart 1997.iso / SurfCam / SURFCAM.Z / UNCL01.F02 < prev    next >
Text File  |  1996-04-01  |  10KB  |  176 lines

  1. $$                              Fanuc 10T
  2. $$ 2/1/96 Support for cutter comp.
  3. $$ 2/1/96 Cancel Tool Offset, Spindle & Send Tool Home
  4. $$ 2/2/96 G76 or G33 Threading using Relcom 1351
  5. $$ 3/11/96 Check the Pprint or ID or OD
  6. $$ 3/13/96 Added part number prompt
  7. $$ 4/5/96 Added user defined comments
  8.  
  9. $$ PRINT/ON; XX = POSTF(24,1)       $$ DIAGNOSTICS
  10. REDEF/ON                            $$ ALLOW VARIABLES TO BE OVERWRITTEN
  11. LASTT=-99                           $$ LASTT IS USED FOR CHECKING TOOL NO.
  12. COMPCD=40                           $$ COMPCD IS USED FOR CUTTER COMP.
  13. $$  VARIABLES FOR COMMENTS
  14. RESERV/SCNOTE,11                    $$ ASSIGN VARIABLES TO TRAP 
  15. SCNOTE(1)=TEXT/'SURFCAM TOOL'        
  16. SCNOTE(2)=TEXT/'MATERIAL'
  17. SCNOTE(3)=TEXT/'NUM FLUTES'
  18. SCNOTE(4)=TEXT/'TAPER ANGLE'
  19. SCNOTE(5)=TEXT/'OFFSET FROM SURFACE'
  20. SCNOTE(6)=TEXT/'PROGRAM UNITS'
  21. SCNOTE(7)=TEXT/'PROGRAMMED TO'
  22. SCNOTE(8)=TEXT/'TURRET NO.'
  23. SCNOTE(9)=TEXT/'TIP RADIUS'
  24. SCNOTE(10)=TEXT/'ORIENTATION'
  25. SCNOTE(11)=TEXT/'DESCRIPTION'
  26.  
  27. $$ THIS MACRO CONVERTS LOWER CASE CHARACTERS TO UPPER CASE.
  28. $$ AT TERMAC, UPCHAR CONTAINS UPPER CASE VERSION OF STRING PASSED ON CALL
  29. UPRCAS=MACRO/CHARS                  $$ CHARS IS SYMBOLIC NAME OF STRING
  30.   UPCHAR=TEXT/CHARS                 $$ SET UPCHAR TO EQUAL THE UPPERCASE PPRINT
  31.   DO/UPPIT,KK=1,26                  $$ LOOP 1 TO 26 (A TO Z)
  32.      LOWER1=TEXT/CONVS,(96+KK)      $$ GET LOWER CASE     A -> Z
  33.      UPPER1=TEXT/CONVS,(64+KK)      $$ EQUIVALENT UPPER CASE  A -> Z
  34.      UPCHAR=TEXT/MODIFY,UPCHAR,LOWER1,UPPER1,0 $$ CONVERT ALL LOWERS TO UPPERS
  35.   UPPIT) CONTIN                     $$ CAUSE REPETITION OF LOOP
  36. TERMAC                              $$ TERMINATE MACRO
  37.  
  38. ODTHRD=TEXT/'ODTHREADING'           $$ SET VARIABLE FOR ODTHREADING
  39. IDTHRD=TEXT/'IDTHREADING'           $$ SET VARIABLE FOR IDTHREADING
  40.  
  41. $$ <<<<<<<<<<<<<<<<<<<<<  END OF INITIALIZATION AREA  >>>>>>>>>>>>>>>>>>>>>>>>
  42.  
  43. CIMFIL/ON,PARTNO                    $$ TRAPS PARTNO STATEMENT
  44.  STRNG=TEXT/CLW                     $$ STORES THE CONTENTS INTO STRNG
  45.  STRNG=TEXT/OMIT,STRNG,1            $$ REMOVES ALL OF THE SPACES
  46.  CMPR=CMPRF(STRNG,(TEXT/' 0'))      $$ COMPARES VALUE TO ZERO, 0=TRUE 1=FALSE
  47.  IF(CMPR.EQ.1)THEN                  $$ IF FALSE(1) THEN...
  48.   PROMPT=TEXT/'Enter program library number' $$ STORES THE DESIRED STRING TO PROMPT
  49.   DUMMY=FILEF(0,1,PROMPT)           $$ OPEN FILE#0 AND WRITE TEXT STORED IN PROMPT
  50.   STRNG=TEXT/READ,0                 $$ OVERWRITE STRING WITH THE USER(TERMINAL) INPUT
  51.  ENDIF                              $$ END TEST
  52.  PARTNO/STRNG                       $$ RESET THE PARTNO TO USER INPUT(STRING)
  53. CIMFIL/OFF                          $$ CLOSE FIL
  54.  
  55. CIMFIL/ON,MACHIN                    $$ TRAPS MACHIN STATEMENT 
  56.  DUMMY=POSTF(13)                    $$ SEND RECORD TO POST
  57.  SEQNO/OFF                          $$ TURNS SEQUENCE NUMBERS OFF
  58.  INSERT/'O',STRNG,'$'               $$ INSERT O ADDRESS AND NEW PROGRAM #(STRING)
  59. CIMFIL/OFF                          $$ CLOSE FIL 
  60.  
  61. CIMFIL/ON,CUTCOM                    $$ TRAP CUTCOM(CUTTER COMP)
  62.   WRD4=POSTF(7,4)                   $$ ASSIGN THE CUTCOM TO WRD4
  63.   CASE/WRD4                         $$ TEST FOR CUTTER COMP.
  64.    WHEN/(ICODEF(LEFT))              $$ CUTTER COMP LEFT 
  65.      COMPCD=41                      $$ SETS COMPCD EQUAL TO 41
  66.    WHEN/(ICODEF(RIGHT))             $$ CUTTER COMP RIGHT
  67.      COMPCD=42                      $$ SETS COMPCD EQUAL TO 42
  68.    WHEN/(ICODEF(OFF))               $$ CUTTER COMP OFF
  69.      COMPCD=40                      $$ SETS COMPCD EQUAL TO 40
  70.   ENDCAS                            $$ END TEST
  71.   IF(COMPCD.GE.41)THEN              $$ CHECK IF COMP IS >OR = 41
  72.    REPEAT/OFF                       $$ TURN OFF THE REPEAT COMMAND
  73.    REPEAT/24,26,7,COMPCD,ALL        $$ OUTPUT 24=X, 26=Z, 7=G(40,41,42)
  74.     ELSE                            $$ OR...
  75.     PREFUN/COMPCD                   $$ OUTPUT G41,G42,OR G40
  76.    ENDIF                            $$ END OF IF STATEMENT
  77. CIMFIL/OFF                          $$ END ROUTINE
  78.  
  79.                                     $$ HANDLING COMP AT END OF SEQUENCE
  80. CIMFIL/ON,LOADTL                    $$ TRAP LOADTL(TOOLCHANGE)
  81.                                     $$ USED FOR TOOL & OFFSET NUMBERS                        
  82.    TNUM=POSTF(7,4)                  $$ ASSIGN THE TOOL NUMBER TO TNUM 
  83.    TOFF=POSTF(7,6)                  $$ ASSIGN THE TOOL OFFSET TO TOFF
  84.   IF(TNUM.EQ.LASTT)THEN             $$ CHECK IF TOOL NUMBER HAS CHANGED
  85.    SELECT/TOFF                      $$ MEANS ONLY OFFSET WAS CHANGED
  86.   ELSE                              $$ REAL INDEX (PREFORM A TOOLCHANGE)
  87.    IF(COMPCD.NE.40)PREFUN/40        $$ SETS THE CUTTER COMP TO OFF
  88.    COMPCD=40                        $$ SET CUTTER COMP TO 40
  89.      IF(LASTT.NE.-99)THEN           $$ CHECK IF THIS IS THE 1ST TOOL
  90.       SELECT/0,NEXT                 $$ WILL PUT OUT THE TCODE WITH 00 NEXT LINE
  91.       AUXFUN/5,NEXT                 $$ OUTPUTS THE M5 NEXT LINE
  92.      ENDIF                          $$ END OF IF STATEMENT
  93.    RAPID;GOHOME                     $$ SEND TOOL BACK TO HOME POSITION
  94.    TURRET/TNUM,TOFF,0,0             $$ CALL UP THE NEXT TOOL & OFFSET
  95.    LASTT=TNUM                       $$ SETTING LAST TOOL EQUAL TO TOOL NUMBER
  96.   ENDIF                             $$ END OF IF STATEMENT
  97. $$SEQNO/ON                          $$ SEQUENCE NUMBERS
  98. CIMFIL/OFF                          $$ END ROUTINE
  99.  
  100.                                     $$ HANDLING COMP AT END   
  101. CIMFIL/ON,END                       $$ LOOKING FOR END
  102.    RSTL=POSTF(20)                   $$ SAVE END     
  103.    SELECT/0,NEXT                    $$ WILL PUT OUT THE TCODE WITH 00 NEXT LINE
  104.    AUXFUN/5,NEXT                    $$ OUTPUTS THE M5 NEXT LINE
  105.    RAPID;GOHOME                     $$ SEND TOOL BACK TO HOME POSITION   
  106.    RSTL=POSTF(21)                   $$ RESTORE
  107.    RSTL=POSTF(13)                   $$ SEND RECORD TO POST
  108. CIMFIL/OFF                          $$ END ROUTINE
  109.  
  110. CIMFIL/ON,THREAD                    $$ TRAP FOR THREAD
  111. CHKREL=POSTF(1,2,1351)              $$ CHECK FOR CANNED CYCLE
  112. IF(CHKREL.EQ.76)THEN                $$ CHECK IF RELCOM FOR 1351 IS 76
  113.   X1=POSTF(7,5)                     $$ START POINT IN Z
  114.   Y1=POSTF(7,6)                     $$ START POINT IN X
  115.   Z1=POSTF(7,7)                     $$ VALUE IS NOT USED
  116.   X2=POSTF(7,9)                     $$ END POINT IN Z
  117.   Y2=POSTF(7,10)                    $$ END POINT IN X
  118.   Z2=POSTF(7,11)                    $$ VALUE IS NOT USED
  119.   LEAD=(POSTF(7,13))                $$ ALWAYS PITCH
  120.   LEAD=1/LEAD                       $$ ESTABLISH THE PITCH
  121.   PRCNT=POSTF(7,15)                 $$ PERCENTAGE USED FOR TOTAL DEPTH       
  122.   TOTDPT=ABSF(POSTF(7,20))          $$ ABSOLUTE TOTAL DEPTH OF THREAD
  123.   MINDP=POSTF(7,17)                 $$ MIN DEPTH
  124.   LASTPS=POSTF(7,23)                $$ AMOUNT OF SPRING PASSES
  125.   INFD=90-(POSTF(7,21))             $$ IN FIELD ANGLE
  126.   P2=PRCNT*TOTDPT                   $$ TOTAL DEPTH OF THREAD * PERCENTAGE  
  127.   CLEAR=.1                          $$ DEFINED CLEARANCE AMOUNT
  128.  IF(DRFLAG.NE.0)THEN                $$ DIRECTION IS OD
  129.  CLEAR=(CLEAR*-1)                   $$ CHANGE OFFSET SIDE
  130.  ELSE                               $$ DIRECTION IS ID 
  131.  TOTDPT=(TOTDPT*-1)                 $$ CHANGE DEPTH SIDE
  132.  ENDIF                              $$ END OF IF STATEMENT        
  133. YMUL=POSTF(1,2,1350)                $$ GET RADIAL MULT   
  134.                                     $$ G76 TYPE THREADING CYCLE 
  135. $$        G    X                 Z  $$ RAPID TO CLEARANCE POSITION FOR ID
  136. POSTN/OUT,7,0,24,((Y2+CLEAR)*YMUL),26,X1                                    
  137. $$         X                     Z     P     Q         R   F      G
  138. POSTN/OUT,24,((Y2+TOTDPT)*YMUL),26,X2,16,P2,17,LASTPS,18,0,6,LEAD,7,76    
  139. $$         O                Q        R   G  
  140. POSTN/OUT,15,(010000+INFD),17,MINDP,18,0,7,76                                    
  141. ELSE                                $$ OR, OUTPUT LONGHAND CODE 
  142.   XX=POSTF(13)                      $$ NO CANNED CYCLE, G33 TYPE
  143. ENDIF                               $$ END OF IF STATEMENT  
  144. CIMFIL/OFF                          $$ END ROUTINE
  145.  
  146. CIMFIL/ON,PPRINT                    $$ TRAP FOR THE PPRINTS
  147.   PPSTR=TEXT/CLW                    $$ 66 CHARACTERS OUT OF PPRINT STATMENT
  148.   CNT=0                             $$ INITIALIZE COUNTER
  149. CALL/UPRCAS,CHARS=PPSTR             $$ CALL THE MACRO 'UPRCAS'
  150. PPSTR=TEXT/UPCHAR                   $$ SET PPSTR TO UPPER CHARACTERS
  151.   DO/STRIP,JJ=1,11                  $$ BEGINING DO LOOP
  152.     PP=INDXF(PPSTR,SCNOTE(JJ))      $$ LOOK FOR SUBSTRING MATCH IN COMMENT STRING
  153.     IF(PP.GE.1) THEN                $$ IF COMMENT MATCHES THEN
  154.       CNT=CNT+PP                    $$ ADD PP VALUE TO CNT
  155.     ENDIF                           $$ END OF IF STATEMENT
  156.   STRIP) CONTIN                     $$ END OFf DO LOOP
  157.   IF(CNT.LT.1) THEN                 $$ CHECK THE COMMENTS
  158.     DISPLY/ON                       $$ IF NOT A SURFCAM COMMENT TURN ON DISPLAY
  159.     PPRINT/PPSTR                    $$ PRINT USER COMMENTS 
  160.   ENDIF                             $$ END OF IF STATEMENT
  161.   PPSTR=TEXT/CLW                    $$ 66 CHARACTERS OUT OF PPRINT STATMENT
  162.   PPSTR=TEXT/OMIT,PPSTR,3           $$ THROW OUT ALL BLANKS    
  163. CALL/UPRCAS,CHARS=PPSTR             $$ CALL THE MACRO 'UPRCAS'
  164. PPSTR=TEXT/UPCHAR                   $$ SET PPSTR TO UPPER CHARACTERS
  165. RADLOC=INDXF(PPSTR,IDTHRD)          $$ INDEX TO PPRINT IDTHREADING
  166. IF(RADLOC.NE.0)THEN                 $$ CHECK FOR PPRINT IDTHREADING
  167. DRFLAG=1                            $$ FLAG FOR IDTHREADING
  168. ENDIF                               $$ END OF IF STATEMENT
  169. RADLOC=INDXF(PPSTR,ODTHRD)          $$ INDEX TO PPRINT ODTHREADING 
  170. IF(RADLOC.NE.0)THEN                 $$ CHECK FOR PPRINT ODTHREADING 
  171. DRFLAG=0                            $$ FLAG FOR ODTHREADING 
  172. ENDIF                               $$ END OF IF STATEMENT
  173. CIMFIL/OFF                          $$ END ROUTINE
  174.  
  175. FINI
  176.